import 'package:get/get.dart';

class ShopController extends GetxController{
  RxInt counter = 0.obs;

  void inc(){
    counter++;
    //必须调用update(),否则不会调用Obx()方法局部更新widget
    update();
  }

  void dec(){
    counter--;
    update();
  }

  @override
  void onClose() {
    print("页面销毁");
    super.onClose();
  }

  @override
  void onReady() {
    print("页面加载完成");
    super.onReady();
  }

  @override
  void onInit() {
    print("页面初始化");
    super.onInit();
  }
}
